﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Jurvis
{
    public delegate void DelegateString(string str);

    class ScanCardLibary
    {
        public static event DelegateString LogInfoOut;



        static void getSDI()
        {
            int moveX = 400;
            int moveY = 768;
            int lastX = 0;
            CDmSoft dm = new CDmSoft();
            dm.MoveTo(moveX, moveY);
            OCR ocr = new OCR();

            for(; moveX < 1000; moveX += 2)
            {
                object x, y;
                
                dm.FindPic(0, 0, 2000, 2000, "mp.bmp", "0", 0.8, 1, out x, out y);
                dm.MoveTo(moveX, moveY);
                if (Convert.ToInt32(x) > 0)
                {
                    if (Math.Abs(lastX - Convert.ToInt32(x)) > 5)
                    {
                        lastX = Convert.ToInt32(x);
                        ocr.getPic(Convert.ToInt32(x) - 10, Convert.ToInt32(y) - 35, 260, 375);
                        LogInfoOut("X:" + x.ToString() + "  X:" + y.ToString() + "\r\n");
                    }
                }
            }
        }




        public static void Start()
        {
            getSDI();
        }

        public static void Stop()
        {

        }
    }
}
